package org.example.java8.localDate;

import java.time.LocalDate;
import java.time.Period;
import java.time.temporal.ChronoUnit;

/**
 * java.time.Duration:
 *
 * Duration是用来计算两个给定的日期之间包含多少秒，多少毫秒，它是不可变类且线程安全的
 *
 * java.time.Period:
 * Period是用来计算两个给定的日期之间包含多少天，多少月或者多少年，它是不可变类且线程安全的
 *
 * This class demonstrates JAVA 8 data and time API
 *
 * @author Siva Prasad Rao Janapati
 */
public class PeriodDemonstration {
    /**
     * @param args
     */
    public static void main(String[] args) {
        LocalDate localDate = LocalDate.now();
        Period period = Period.between(localDate, localDate.plus(2, ChronoUnit.DAYS));
        System.out.println(period.getDays());
    }
}